package com.opeartion.controller;

import com.opeartion.pojo.Category;
import com.opeartion.pojo.ClassesRank;
import com.opeartion.service.RankPlusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author sanshi
 * @version 1.0
 * @data 2020/6/6-20:18
 */


@RestController
@RequestMapping("/rankPlus")
public class RankPlusController {
    @Autowired
    private RankPlusService rankPlusService;
    /**
     * 查询
     *
     * @return
     */
    @GetMapping("/rankPlusService")
    public List<ClassesRank> findRankPlus() {
        return rankPlusService.findRankPlus();
    }

    @GetMapping("/findRankPlusOne")
    public List<ClassesRank> findRankPlusOne(String name) {
        return rankPlusService.findRankPlus(name);
    }

    /**
     * 查询所包含的行业
     */
   @GetMapping("/findCategoryAndClass")
    public List<Category> findCategoryAndClass(int id) {
        return rankPlusService.findCategoryAndClass(id);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/deleteClass")
    public int deleteClass(int id) {
        return rankPlusService.deleteClass(id);
    }

    /**
     * 修改
     *
     * @param classesRank
     */
    @PostMapping("/updateRankPlus")
    public void updateRankPlus(ClassesRank classesRank) {
        rankPlusService.updateRankPlus(classesRank);
    }
}
